package com.sunni.aop;

import com.sunni.anno.MyAspect;
import com.sunni.anno.TargetInterface;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext-anno.xml")
public class TargetTest_anno {

    @Autowired
    @Qualifier("target")
    private TargetInterface target;
    /*一定要是TargetInterface接口类型，，，不然报错UnsatisfiedDependencyException什么注入不满意，不能把target这个<bean>注入给它*/

    @Test
    public void testSave() {
        target.save();
    }
}